﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace Restbucks.Server
{
    // this'll be replaced by something more HTTP-ish
    class ServerFacade
    {
        public enum Operation {PUT, GET, DELETE, UPDATE};

        // PUT's...
        public static XDocument Order(Operation operation, XDocument request)
        {
            XDocument response;
            switch (operation)
            {
                case Operation.PUT:
                    response = RestbucksResourceFactory.GetOrderResource().CreateOrder(request);
                    break;
                default:
                    response = null;
                    break;
            }
            return response;
        }

        // GET's...
        public static XDocument Order(Operation operation, string request)
        {
            XDocument response = null;
            switch (operation)
            {
                case Operation.GET:
                    if (request.StartsWith("order"))
                    {
                    }
                    else if (request.StartsWith("somethingelse"))
                    {
                    }
                    else
                    {
                        response = RestbucksResourceFactory.GetOrderResource().GetOrders();
                    }
                    break;
                default:
                    throw new InvalidOperationException(request);
            }
            return response;
        }

    }
}
